# encoding: utf-8
import collections
import json

import xmltodict


def create(_data):
    return xmltodict.unparse(_data, pretty=True)


test1 = '<?xml version="1.0" encoding="utf-8"?><body><response><ret_code>0</ret_code><ret_info>59</ret_info><hospitals><hospital><org_id>100400</org_id><hospital_id>41952986</hospital_id><hospital_name>宁波市李惠利医院</hospital_name><hospital_address><![CDATA[宁波市兴宁路57号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41952986.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87018701</hospital_tel></hospital><hospital><org_id>124216</org_id><hospital_id>34057647</hospital_id><hospital_name>宁波李惠利东部医院</hospital_name><hospital_address><![CDATA[宁波市江南路1111号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2018-04/2018-04-03/E1_20180403091128_2769_0.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>55835583</hospital_tel></hospital><hospital><org_id>124222</org_id><hospital_id>68425438</hospital_id><hospital_name>宁波健民肛肠医院</hospital_name><hospital_address><![CDATA[江东区甬港南路225号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2016-05/2016-05-13/E1_20160513164748_1785_0.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87877375</hospital_tel></hospital><hospital><org_id>100200</org_id><hospital_id>41952983</hospital_id><hospital_name>宁波市第二医院</hospital_name><hospital_address><![CDATA[宁波市西北街41号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41952983.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-83870999</hospital_tel></hospital><hospital><org_id>100300</org_id><hospital_id>41952984</hospital_id><hospital_name>宁波大学医学院附属医院</hospital_name><hospital_address><![CDATA[宁波市人民路247号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41952984.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87035555</hospital_tel></hospital><hospital><org_id>100700</org_id><hospital_id>41952989</hospital_id><hospital_name>宁波市妇女儿童医院</hospital_name><hospital_address><![CDATA[宁波市柳汀街339号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41952989.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87083300</hospital_tel></hospital><hospital><org_id>100500</org_id><hospital_id>41952988</hospital_id><hospital_name>宁波市中医院</hospital_name><hospital_address><![CDATA[宁波市海曙区丽园北路819号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41952988.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87089090</hospital_tel></hospital><hospital><org_id>124181</org_id><hospital_id>73212756</hospital_id><hospital_name>宁波市华慈医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>103100</org_id><hospital_id>43952991</hospital_id><hospital_name>解放军113医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124109</org_id><hospital_id>41954112</hospital_id><hospital_name>海曙区中医院</hospital_name><hospital_address><![CDATA[宁波市开明街415号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41954112.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-56123327</hospital_tel></hospital><hospital><org_id>124171</org_id><hospital_id>41954122</hospital_id><hospital_name>宁波市海曙区口腔医院(开明分院)</hospital_name><hospital_address><![CDATA[开明街413号（开明分院）]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2018-03/2018-03-26/E1_20180326134145_1681_0.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87366153</hospital_tel></hospital><hospital><org_id>124182</org_id><hospital_id>10660001</hospital_id><hospital_name>宁波市海曙区口腔医院(三市总院)</hospital_name><hospital_address><![CDATA[三市路1-2号（三市总院）]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2018-03/2018-03-26/E1_20180326134343_4319_1.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87027158</hospital_tel></hospital><hospital><org_id>100100</org_id><hospital_id>41952980</hospital_id><hospital_name>宁波市第一医院</hospital_name><hospital_address><![CDATA[浙江省宁波市柳汀街59号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41952980.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87085588</hospital_tel></hospital><hospital><org_id>106600</org_id><hospital_id>72638534</hospital_id><hospital_name>宁波市第六医院</hospital_name><hospital_address><![CDATA[宁波江东区中山东路1059号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_72638534.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87801999</hospital_tel></hospital><hospital><org_id>124101</org_id><hospital_id>41954562</hospital_id><hospital_name>宁波市眼科医院</hospital_name><hospital_address><![CDATA[宁波市江东区民安路855号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41954562.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87739000</hospital_tel></hospital><hospital><org_id>124107</org_id><hospital_id>55452284</hospital_id><hospital_name>江东区中医医院(百丈中心)</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124218</org_id><hospital_id>09983915</hospital_id><hospital_name>宁波眼病中心医院</hospital_name><hospital_address><![CDATA[宁波市海曙中山西路文昌街2号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124105</org_id><hospital_id>41955054</hospital_id><hospital_name>宁波市第九医院</hospital_name><hospital_address><![CDATA[宁波市江北区祥北路68号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41955054.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87672961</hospital_tel></hospital><hospital><org_id>106700</org_id><hospital_id>41961191</hospital_id><hospital_name>宁波市鄞州人民医院</hospital_name><hospital_address><![CDATA[宁波市百丈东路251号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41961191.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87017701</hospital_tel></hospital><hospital><org_id>124100</org_id><hospital_id>75628616</hospital_id><hospital_name>鄞州第二医院</hospital_name><hospital_address><![CDATA[宁波市鄞州中心区前河路1号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_75628616.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-55662266</hospital_tel></hospital><hospital><org_id>124110</org_id><hospital_id>73424806</hospital_id><hospital_name>浙江大学明州医院</hospital_name><hospital_address><![CDATA[宁波市泰安西路168号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_73424806.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-83009999</hospital_tel></hospital><hospital><org_id>124178</org_id><hospital_id>41955956</hospital_id><hospital_name>北仑区人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124170</org_id><hospital_id>41956106</hospital_id><hospital_name>北仑区第二人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124215</org_id><hospital_id>41955938</hospital_id><hospital_name>北仑区中医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124225</org_id><hospital_id>73427532</hospital_id><hospital_name>宁波市北仑区小港医院</hospital_name><hospital_address><![CDATA[北仑区小港街道江南东路368号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-86162330</hospital_tel></hospital><hospital><org_id>124255</org_id><hospital_id>41961192</hospital_id><hospital_name>宁波市鄞州区第三医院</hospital_name><hospital_address><![CDATA[鄞州区姜山镇人民南路18号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2017-12/2017-12-27/E1_20171227160913_1378_1.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-88098990</hospital_tel></hospital><hospital><org_id>124236</org_id><hospital_id>41953810</hospital_id><hospital_name>宁波市康复医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124189</org_id><hospital_id>41964258</hospital_id><hospital_name>余姚市第三人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>101300</org_id><hospital_id>41952990</hospital_id><hospital_name>宁波市康宁医院</hospital_name><hospital_address><![CDATA[宁波市镇海区庄市街道庄俞南路1号（庄市总部）、宁波市海曙区范江岸路1105号（宁波市心理咨询治疗中心）]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41952990.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-26251111（庄市总部）;0574-26252222（宁波心理咨询治疗中心）</hospital_tel></hospital><hospital><org_id>124212</org_id><hospital_id>58054987</hospital_id><hospital_name>宁波江北区儿童医院</hospital_name><hospital_address><![CDATA[宁波市江北区新马路50号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-55012698</hospital_tel></hospital><hospital><org_id>124238</org_id><hospital_id>72040720</hospital_id><hospital_name>余姚市第二人民医院</hospital_name><hospital_address><![CDATA[余姚市学弄49号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-62751999</hospital_tel></hospital><hospital><org_id>124194</org_id><hospital_id>71338542</hospital_id><hospital_name>余姚市第四人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124190</org_id><hospital_id>41957480</hospital_id><hospital_name>象山县红十字台胞医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124187</org_id><hospital_id>41957476</hospital_id><hospital_name>象山县第一人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124185</org_id><hospital_id>41971853</hospital_id><hospital_name>奉化区人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124186</org_id><hospital_id>41971819</hospital_id><hospital_name>奉化区溪口医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124102</org_id><hospital_id>41971858</hospital_id><hospital_name>奉化区中医医院</hospital_name><hospital_address><![CDATA[奉化中山路22号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/Hospital/mobile_41971858.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-88586008</hospital_tel></hospital><hospital><org_id>124219</org_id><hospital_id>41971950</hospital_id><hospital_name>奉化新桥骨科医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124188</org_id><hospital_id>72046136</hospital_id><hospital_name>象山县第三人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124183</org_id><hospital_id>41957477</hospital_id><hospital_name>象山县中医医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124191</org_id><hospital_id>71721562</hospital_id><hospital_name>余姚市人民医院</hospital_name><hospital_address><![CDATA[余姚市城东路800路]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-62629999</hospital_tel></hospital><hospital><org_id>124209</org_id><hospital_id>07922515</hospital_id><hospital_name>宁波爱尔光明眼科医院</hospital_name><hospital_address><![CDATA[宁波市环城北路西段8号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>87666106</hospital_tel></hospital><hospital><org_id>124197</org_id><hospital_id>67122863</hospital_id><hospital_name>镇海区炼化医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124200</org_id><hospital_id>41956646</hospital_id><hospital_name>镇海区中医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124207</org_id><hospital_id>41959207</hospital_id><hospital_name>宁海县第一医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124237</org_id><hospital_id>41959192</hospital_id><hospital_name>宁海县第二医院</hospital_name><hospital_address><![CDATA[浙江省宁波市宁海县城关桃源南路319号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-65577290</hospital_tel></hospital><hospital><org_id>124213</org_id><hospital_id>41968827</hospital_id><hospital_name>慈溪市人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124256</org_id><hospital_id>12330203</hospital_id><hospital_name>海曙区第二医院</hospital_name><hospital_address><![CDATA[海曙区石契街道益智中路52号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87551314</hospital_tel></hospital><hospital><org_id>124226</org_id><hospital_id>41968979</hospital_id><hospital_name>宁波市第一医院慈溪医院（慈溪市龙山医院）</hospital_name><hospital_address><![CDATA[龙山滨海新城灵峰路1200号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-63701016</hospital_tel></hospital><hospital><org_id>124252</org_id><hospital_id>41961183</hospital_id><hospital_name>海曙区第三医院</hospital_name><hospital_address><![CDATA[海曙区集士港镇香雪路1027号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2017-11/2017-11-03/E1_20171103140916_6384_2.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-56809966</hospital_tel></hospital><hospital><org_id>124228</org_id><hospital_id>78430366</hospital_id><hospital_name>宁波口腔医院</hospital_name><hospital_address><![CDATA[海曙区解放南路287号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2016-11/2016-11-07/E1_20161107112003_7903_0.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87328181</hospital_tel></hospital><hospital><org_id>124221</org_id><hospital_id>32166085</hospital_id><hospital_name>宁波鄞州眼科医院(甬兴西路88号,中河派出所旁)</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124211</org_id><hospital_id>09758586</hospital_id><hospital_name>宁波第五医院（宁波肿瘤医院）</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-87606666</hospital_tel></hospital><hospital><org_id>124201</org_id><hospital_id>41956645</hospital_id><hospital_name>镇海区龙赛医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124202</org_id><hospital_id>69822981</hospital_id><hospital_name>镇海区人民医院</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124217</org_id><hospital_id>09192423</hospital_id><hospital_name>宁波鄞州艾博尔妇产医院</hospital_name><hospital_address><![CDATA[宁波鄞州区环城南路东段999号(桑田南路交叉口)]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2016-10/2016-10-26/E1_20161026090411_0557_0.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-66868888</hospital_tel></hospital><hospital><org_id>124231</org_id><hospital_id>41956651</hospital_id><hospital_name>镇海庄市街道社区卫生服务中心(佩珍医院)</hospital_name><hospital_address></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel></hospital_tel></hospital><hospital><org_id>124232</org_id><hospital_id>41955939</hospital_id><hospital_name>宁波大榭开发区医院</hospital_name><hospital_address><![CDATA[大榭开发区兴岛南路292号]]></hospital_address><hospital_picture></hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>86765411</hospital_tel></hospital><hospital><org_id>124233</org_id><hospital_id>102900</hospital_id><hospital_name>宁波开发区中心医院</hospital_name><hospital_address><![CDATA[北仑区华山路666号]]></hospital_address><hospital_picture>http://pic.nbwjw.gov.cn/AttachmentPath/AjaxUpload/image/2017-03/2017-03-31/E1_20170331164401_5616_0.jpg</hospital_picture><hospital_reg_status>Y</hospital_reg_status><hospital_tel>0574-86877119</hospital_tel></hospital></hospitals></response></body>'

if __name__ == '__main__':
    xml_dict = xmltodict.parse("""
  <mydocument has="an attribute">
    <and>
      <many>elements</many>
      <many>more elements</many>
    </and>
    <plus a="complex">
      element as well
    </plus>
  </mydocument>
  """)

    xml_dict = xmltodict.parse(test1, encoding='utf-8')
    print(json.dumps(xml_dict))
    print(xml_dict.get('mydocument'))

    odic = collections.OrderedDict()
    odic['a'] = 'va'
    odic['c'] = 'vc'
    odic['d'] = 'vd'
    odic['b'] = 'vb'
    print(create({"response": odic}))
